def dfs(n):

    global cent
    for i in range(len(num) - 2):
        if num[i] == num[i + 1]:
            num[i+1], num[i + 2] = num[i + 2], num[i+1]
            cent += 1
            if num[i]==num[i+1]:
                return dfs(0)
    return cent


n = int(input())
cent = 0
num=list(map(int,input().split()))
print(dfs(n))

n,a=int(input())*2,0
s=list(map(int,input().split()))
for i in range (n):
  a+=not(s[i]^(i%2))
print(min(a//2,(n-a)//2))